package com.leaf.spring.y201906.day25.arithmetic.random;

import java.util.Random;

import com.leaf.spring.y201906.day25.arithmetic.ServerIps;

/**
 * 随机算法实现负载均衡
 * 
 * @Title:
 * @Description:
 * @Author: leaf
 * @Since:2019年6月25日
 * @Version:1.1.0
 */
public class RandomArith {

	public String getServer() {

		return ServerIps.LIST.get(new Random().nextInt(ServerIps.LIST.size()));

	}

	public static void main(String[] args) {

		RandomArith arith = new RandomArith();
		for (int i = 0; i < 10; i++) {

			System.out.println(arith.getServer());

		}

	}

}
